//
//  AuctionAlertView.swift
//  LeGou
//
//  Created by lxm on 2022/12/7.
//

import UIKit

class AuctionAlertView: ZMXIBView {

    //MARK: --------------------属性--------------------
    var onClick : (()->())?
    //MARK: --------------------UI控件--------------------
    @IBOutlet weak var timeLabel: UILabel!
    
    @IBOutlet weak var jpBtn: UIButton!
    
    //MARK: --------------------生命周期--------------------
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        setUI()
        bindAction()
        addConstraints()
    }

    //MARK: --------------------UI--------------------
    func setUI() {
        zm.addTap(target: self, selector: #selector(onTap))
    }
    
    func addConstraints() {
     
    }
    
    //MARK: --------------------methods--------------------
    func bindAction() {
        
    }
    
    @objc func onTap() {
        if let onClick = onClick {
            onClick()
        }
    }
    
    func setJionButtonStyle(type : Int) {
         if type == 0 {
            jpBtn.setTitle("提醒我", for: .normal)
            jpBtn.setImage(UIImage.init(named: "auction_clock_w"), for: .normal)
             backgroundColor = "#48A1A7".zm.hex()
            jpBtn.setTitleColor(.white, for: .normal)
        }
        else {
            jpBtn.setTitle("取消提醒", for: .normal)
            jpBtn.setImage(UIImage.init(named: "auction_clock_g"), for: .normal)
            backgroundColor = UIColor.zm.color(hexString: "#48A1A7", 0.1)
            jpBtn.setTitleColor("#48A1A7".zm.hex(), for: .normal)
        }
    }
    
    //MARK: --------------------delegate--------------------

}
